/* 全局表格样式 - 统一文字居中对齐 */

/* Element Plus 表格全局样式 */
.el-table {
  /* 表头居中对齐 */
  .el-table__header-wrapper .el-table__header th {
    text-align: center !important;
  }
  
  /* 表头单元格内容居中 */
  .el-table__header-wrapper .el-table__header th .cell {
    text-align: center !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
  }
  
  /* 表体单元格居中对齐 */
  .el-table__body-wrapper .el-table__body td {
    text-align: center !important;
  }
  
  /* 表体单元格内容居中 */
  .el-table__body-wrapper .el-table__body td .cell {
    text-align: center !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
  }
  
  /* 固定列也要居中 */
  .el-table__fixed .el-table__fixed-header-wrapper th,
  .el-table__fixed .el-table__fixed-body-wrapper td {
    text-align: center !important;
  }
  
  .el-table__fixed .el-table__fixed-header-wrapper th .cell,
  .el-table__fixed .el-table__fixed-body-wrapper td .cell {
    text-align: center !important;
    justify-content: center !important;
    display: flex !important;
    align-items: center !important;
  }
}

/* 特殊情况：商品名称等需要左对齐的列 */
.el-table .text-left,
.el-table .text-left .cell {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* 特殊情况：金额等需要右对齐的列 */
.el-table .text-right,
.el-table .text-right .cell {
  text-align: right !important;
  justify-content: flex-end !important;
}

/* 确保按钮组在表格中居中显示 */
.el-table .cell .el-button-group,
.el-table .cell .action-buttons,
.el-table .cell .responsive-actions {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px;
}

/* 确保标签在表格中居中显示 */
.el-table .cell .el-tag {
  margin: 0 auto;
}

/* 确保图片在表格中居中显示 */
.el-table .cell .el-image,
.el-table .cell .product-image {
  margin: 0 auto;
  display: block;
}

/* 商品信息组合显示时的特殊处理 */
.el-table .cell .product-info {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px;
}

.el-table .cell .product-details {
  text-align: center;
}

/* 数字显示优化 */
.el-table .cell .quantity,
.el-table .cell .price,
.el-table .cell .subtotal,
.el-table .cell .sales-amount,
.el-table .cell .average-amount {
  font-weight: 600;
  display: inline-block;
}

/* 状态标签优化 */
.el-table .cell .status-tag {
  display: inline-block;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .el-table .cell {
    padding: 4px 2px !important;
    font-size: 12px !important;
  }
  
  /* 移动端保持居中对齐 */
  .el-table .cell {
    text-align: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {
  .el-table .cell {
    padding: 2px 1px !important;
    font-size: 11px !important;
  }
}

/* 特定页面的表格样式覆盖 */
/* 商品管理页面 - 商品名称左对齐 */
.products-container .el-table .el-table-column--name .cell,
.products-container .el-table .product-name {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* 订单管理页面 - 订单号左对齐 */
.orders-container .el-table .el-table-column--orderNo .cell {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* 用户管理页面 - 用户名左对齐 */
.users-container .el-table .el-table-column--username .cell,
.users-container .el-table .el-table-column--name .cell {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* 库存管理页面 - 商品名称左对齐 */
.inventory-container .el-table .product-name,
.inventory-container .el-table .el-table-column--name .cell {
  text-align: left !important;
  justify-content: flex-start !important;
}

/* 确保表格内的复杂内容正确显示 */
.el-table .cell > div {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 文本内容的特殊处理 */
.el-table .cell > span,
.el-table .cell > p {
  text-align: center;
  width: 100%;
}

/* 表格排序图标居中 */
.el-table .caret-wrapper {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: 5px;
}
